package artid.com.arttogoa.adapter;

import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import artid.com.arttogoa.R;
import artid.com.arttogoa.parser.MySellInfo_ImageBean;
import artid.com.arttogoa.util.NetUtils;
import com.nostra13.universalimageloader.core.ImageLoader;

/**
 * 
*    
* 项目名称：ArtworkArtA   
* 类名称   ：MySellInfo_Adapter   
* 类描述   ：我出售的详情适配器   
* 创建人   ：耿卫斌   
* 创建时间：2016-7-22 上午11:18:11   
*
 */
public class MySellInfo_Adapter extends BaseAdapter{
	private Context mContext;
	private List<MySellInfo_ImageBean> list;
	
	public MySellInfo_Adapter(Context mContext, List<MySellInfo_ImageBean> list) {
		super();
		this.mContext = mContext;
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder = null;
		View v = convertView;
		if (v == null) {
			holder = new ViewHolder();
			v = LayoutInflater.from(mContext).inflate(R.layout.item_mysellinfo, null);
			holder.img=(ImageView) v.findViewById(R.id.item_mysellinfo_img);
			v.setTag(holder);
		} else {
			holder = (ViewHolder) v.getTag();
		}
		ImageLoader.getInstance().displayImage(list.get(position).getGoods_image()
				+ "_"+ (Integer.parseInt(NetUtils.getDisplayMetrics((Activity)mContext).get(NetUtils.DM_WIDTH)) / 2) + "x10.png",
				holder.img);
		return v;
	}
	class ViewHolder {
		ImageView img;
	}

}
